<template>
	<view>
		<view class="headbox">
			<text class="today">今日交易金额</text>
			<view class="todayData">
				<text>{{getlist.interest}}</text>
			</view>
			<view class="dataDetail">
				<view class="detailOne" style="border-left: none;">
					<text class="statisticsFont">浏览人数</text>
					<text class="statisticsData">{{getlist.browser_times}}</text>
				</view>
				<view class="detailOne">
					<text class="statisticsFont">付款订单数</text>
					<text class="statisticsData">{{getlist.order_amount}}</text>
				</view>
				<view class="detailOne">
					<text class="statisticsFont">付款件数</text>
					<text class="statisticsData">{{getlist.goods_amount}}</text>
				</view>
			</view>
		</view>
		<view class="main">
			<text class="frame"></text>
			<text class="management">商家管理</text>
			<view class="managementBox">
				<view @click="gostoremanag" class="shopbox">
					<image class="shopImg" src="../../../static/user2/dianpu.png"></image>
					<text class="shopfont">店铺管理</text>
				</view>
				<view @click="goCommdity" class="shopbox">
					<image class="shopImg" src="../../../static/user2/shangping.png"></image>
					<text class="shopfont">商品管理</text>
				</view>
				<view @click="goorder" class="shopbox">
					<image class="shopImg" src="../../../static/user2/dingdan.png"></image>
					<text class="shopfont">订单管理</text>
				</view>
				<view @click="goComission" class="shopbox">
					<image class="shopImg" src="../../../static/user2/pinzheng.png"></image>
					<text class="shopfont">凭证发放</text>
				</view>
				<view @click="goassets" class="shopbox">
					<image class="shopImg" src="../../../static/user2/shangjia.png"></image>
					<text class="shopfont">商家资产</text>
				</view>
				<view @click="goQrcode" class="shopbox">
					<image class="shopImg" src="../../../static/user2/erweima.png"></image>
					<text class="shopfont">店铺二维码</text>
				</view>
			</view>
			<text class="framea"></text>
			<text class="infoManagement">信息管理</text>
			<view class="propmtBox">
				<text class="propmtFont">消息提示</text>
				<switch :checked="haha" @change="switch1Change" style="transform: scale(0.5,0.5); position: absolute;right: 10rpx;"  />
				 <!-- <switch checked="true" /> -->
			</view>
		</view>
	</view>
</template>

<script>
	import Require from '@/common/require.js';
	export default {
		data() {
			return {
				getlist:'',
				haha:''
			};
		},
		onShow() {
			var self=this
			self.get_banner()
		},
		methods: {
			  switch1Change: function (e) {
				  var self=this
						let xuanzhong=e.target.value
						self.xiaoxi(xuanzhong)
			        },
					
			// 消息提示
					xiaoxi(xuanzhong) {
						var self = this;
						if(xuanzhong==false){
							xuanzhong=0
						}else{
							xuanzhong=1
						}
						console.log(xuanzhong)
						Require.commonRequest({
							url: '/api/merchant/setnotice',
							data:{
								state:xuanzhong,
								id:self.getlist.store_id
							},
							success: function(ret) {
								if (ret.data.code == 200) {
									console.log(ret.data.data)
									self.get_banner()
								} else {
									uni.showToast({
										icon: 'none',
										title: ret.data.msg,
									});
								}
							},
							fail: function() {
								uni.showToast({
									icon: "none",
									title: "网络异常，请稍后再试"
								})
							}
						})
					},
			// 数据接口
			get_banner() {
				var self = this;
				Require.commonRequest({
					url: '/api/merchant/index',
					success: function(ret) {
						if (ret.data.code == 200) {
							console.log(ret.data.data)
							self.getlist=ret.data.data
							if(self.getlist.notice_status==1){
								self.haha=true
							}else if(self.getlist.notice_status==0){
								self.haha=false
							}
						} else {
							uni.showToast({
								icon: 'none',
								title: ret.data.msg,
							});
						}
					},
					fail: function() {
						uni.showToast({
							icon: "none",
							title: "网络异常，请稍后再试"
						})
					}
				})
			},
			
			
			
			
			
			
			
			
			
			
			back() {
				uni.navigateBack({
					delta: 1,
				})
			},
			goCommdity() {
				uni.navigateTo({
					url: './commanagement'
				})
			},
			goassets() {
				uni.navigateTo({
					url: './merchantAssets'
				})
			},
			gostoremanag() {
				uni.navigateTo({
					url: './storemanagement'
				})
			},
			goQrcode() {
				uni.navigateTo({
					url: './storeQrcode'
				})
			},
			goorder() {
				uni.navigateTo({
					url: './orderManagement'
				})
			},
			goComission() {
				uni.navigateTo({
					url: './commissionPay'
				})
			}
		}
	}
</script>

<style>
	.switchNumber {
		font-size: 26rpx;
		color: #D420EE;
		position: absolute;
		top: 30rpx;
		right: 24rpx;
	}

	.headbox {
		width: 710rpx;
		height: 300rpx;
		background: rgba(115, 34, 216, 1);
		box-shadow: 0rpx 0rpx 17rpx 3rpx rgba(115, 34, 216, 0.1);
		opacity: 0.8;
		border-radius: 20rpx;
		position: relative;
		top: 20rpx;
		left: 20rpx;
	}

	.today {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #CFA9FF;
		position: absolute;
		top: 29rpx;
		left: 275rpx;
	}

	.todayData {
		width: 710rpx;
		height: 40rpx;
		font-size: 34rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		display: flex;
		justify-content: center;
		align-items: center;
		position: absolute;
		top: 80rpx;
	}

	.dataDetail {
		width: 710rpx;
		height: 150rpx;
		position: relative;
		top: 147rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.detailOne {
		width: 236.5rpx;
		height: 60rpx;
		border-left: 1rpx solid #C7C7C7;
		display: flex;
		justify-content: center;
	}

	.statisticsFont {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #CFA9FF;
		position: absolute;
		top: 25rpx;
	}

	.statisticsData {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		position: absolute;
		top: 87rpx;
	}

	.main {
		width: 710rpx;
		height: 800rpx;
		position: relative;
		left: 20rpx;
		top: 60rpx;
	}

	.frame {
		display: block;
		width: 10rpx;
		height: 30rpx;
		background: rgba(115, 34, 216, 1);
		border-radius: 5rpx;
		position: absolute;
		top: 7rpx;
		left: 0rpx;
	}

	.management {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(46, 46, 46, 1);
		position: absolute;
		top: 0rpx;
		left: 25rpx;
	}

	.managementBox {
		width: 710rpx;
		height: 380rpx;
		position: relative;
		top: 75rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		align-content: space-between;
	}

	.shopbox {
		width: 226rpx;
		height: 180rpx;
		background: rgba(255, 255, 255, 1);
		box-shadow: 0rpx 0rpx 17rpx 3rpx rgba(115, 34, 216, 0.1);
		border-radius: 20rpx;
		display: flex;
		justify-content: center;
		position: relative;
	}

	.shopImg {
		position: absolute;
		top: 40rpx;
	}

	.shopImg:nth-child(1) {
		width: 62rpx;
		height: 57rpx;
	}

	.shopImg:nth-child(2) {
		width: 54rpx;
		height: 58rpx;
	}

	.shopImg:nth-child(3) {
		width: 60rpx;
		height: 56rpx;
	}

	.shopImg:nth-child(4) {
		width: 50rpx;
		height: 54rpx;
	}

	.shopImg:nth-child(5) {
		width: 58rpx;
		height: 57rpx;
	}

	.shopImg:nth-child(6) {
		width: 56rpx;
		height: 56rpx;
	}

	.shopfont {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		position: absolute;
		bottom: 29rpx;
	}

	.framea {
		display: block;
		width: 10rpx;
		height: 30rpx;
		background: rgba(115, 34, 216, 1);
		border-radius: 5rpx;
		position: absolute;
		top: 500rpx;
	}

	.infoManagement {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(46, 46, 46, 1);
		position: absolute;
		top: 496rpx;
		left: 25rpx;
	}

	.propmtBox {
		width: 710rpx;
		height: 100rpx;
		background: rgba(255, 255, 255, 1);
		border-radius: 20rpx;
		display: flex;
		align-items: center;
		position: relative;
		top: 190rpx;
	}

	.propmtFont {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		position: absolute;
		left: 20rpx;
	}
</style>
